package org.zasadnyy.redlions.players.client.ds;

import java.util.List;
import java.util.Map;

import org.zasadnyy.redlions.players.shared.model.TournamentItem;

import com.smartgwt.client.data.Record;

public class TournamentsRecord extends Record {

	public TournamentsRecord(Map<Integer, List<TournamentItem>> tournaments) {
		for (Map.Entry<Integer, List<TournamentItem>> entry : tournaments
				.entrySet()) {
			
			List<TournamentItem> tournamentsList = entry.getValue();
			String year = entry.getKey().toString();
			
			TournamentRecord[] records = new TournamentRecord[tournamentsList
					.size()];
			for (int i = 0; i < records.length; i++) {
				records[i] = new TournamentRecord(tournamentsList.get(i));
			}
			
			setAttribute(year, records);
		}
	}

}
